import time

from selenium import webdriver

from ..common.ui.Selector import Selector
import pytest

from .Pagination import Pagination


def test_pagination():
    browser = webdriver.Chrome()
    browser.maximize_window()
    browser.get("https://fish.iwhalecloud.com/fish-desktop/examples/pagination/index.html")
    time.sleep(2)
    try:
        pagination = Pagination(browser, "pagination-demo", Selector.ID)
        pagination.click("3")
        pagination.click("prev")
        pagination.click("4")
        pagination.click("first")
        pagination.click("3")
        pagination.click("last")
        pagination.click("first")
        pagination.click("next")
    finally:
        browser.close()


if __name__ == '__main__':
    pytest.main(['-s','Pagination_test.py'])